#!/bin/sh
#-----------------------------------------------------
# getflash (automatic update the plugin with the last version available)
# 20151023 ASRI: first version for getflash-1.5.7
# 20170204 rerwin: move prefs initialisation from pinstall.sh for getflash-1.7
#-----------------------------------------------------

##  ANL01 = Application Name writing Lowercase => to be use in different parts of the script
ANL01="getflash"
APPBIN="/usr/sbin/$ANL01"
APPPREFS="$HOME/.getflash/getflash-prefs"
APPLAUNCHER="$APPBIN -a" # -a for automatic search/update

[ -f $APPPREFS ] || cat > $APPPREFS <<-EOF
	## getflash user preferences
	
	## AUTOUPDATECHECK: true = check for updates at startup | false = do not check for updates at startup
	AUTOUPDATECHECK="false"
	
	## AUTOUPDATESILENTINSTALL: true = silent install | false = verbose install (user need to confirm installation of the plugin)
	AUTOUPDATESILENTINSTALL="false"
	
	## AUTOUPDATESTARTUPDELAY: delay (in seconds) before startup (/root/Startup/getflash_auto) = to wait internet connection
	AUTOUPDATESTARTUPDELAY="100"
	EOF

## Check if need to start APPLAUNCHER
. $APPPREFS
if [ $AUTOUPDATECHECK = "true" ];then
	sleep $AUTOUPDATESTARTUPDELAY
	$APPLAUNCHER &
fi


exit 0
